<template>
	<view class="page">
		<topDetail></topDetail>
		<view class="ful">
			<view class="ful_left">
				图片
			</view>
			<view class="ful_right">

			</view>
		</view>
		<view class="ful">
			<view class="ful_left">
				描述
			</view>
			<view class="ful_right">

			</view>
		</view>
		<block v-if="status==1">
			<view class="btn_desp" @tap="jumpReport">
				填写维修报告
			</view>
		</block>
		<block v-else-if="status==2">
			<view class="evaluate">
				<text>评价：</text>
				<view class="stars">
					<image :src="item" v-for="(item,index) in stars" :key='index' @tap="choiceStrt(index)"></image>
				</view>
			</view>
			<view class="btn_desp" @tap="jumpReport">
				点击查看维修报告
			</view>
		</block>
		<block v-else-if="status==3"></block>

	</view>
</template>

<script>
	import topDetail from '@/components/top_detail.vue'
	export default {
		components: {
			topDetail
		},
		data() {
			return {
				id: null,
				//1进行中  2待评价  3已完成
				status: null,
				//星星评分  样式
				stars: [
					"/static/img/stars.png",
					"/static/img/stars.png",
					"/static/img/stars.png",
					"/static/img/stars.png",
					"/static/img/stars.png"
				],
				empty: [
					"/static/img/stars.png",
					"/static/img/stars.png",
					"/static/img/stars.png",
					"/static/img/stars.png",
					"/static/img/stars.png"
				],
				//星星评分  具体数量
				num:0
			}
		},
		onLoad(e) {
			this.id = e.id
			this.status = e.status
		},
		onShow(e) {

		},
		methods: {
			jumpReport() {
				uni.navigateTo({
					url: '../report/report?type=' + this.status
				})
			},
			//星星评分
			choiceStrt(i) {
				this.stars = [...this.empty]
				this.num=i+1
				
				for (let j = 0; j < this.num; j++) {
					this.stars.splice(j, 1, '/static/img/starsed.png')
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.stars {
		width: 320rpx;
		margin: 0 auto;
		position: absolute;
		top: 174rpx;
		transform: translate(50%, 0);
		display: grid;
		grid-column-gap: 30rpx;
		grid-auto-flow: column;

		image {
			width: 40rpx;
			height: 38rpx;
		}
	}

	.evaluate {
		position: relative;
		margin-top: 24rpx;
		height: 252rpx;
		background: #F9F9F9;
		border-radius: 20rpx;
		padding: 20rpx;
		box-sizing: border-box;

		text {
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #7F8084;
			line-height: 40rpx;
		}
	}

	.btn_desp {
		background: #4252CD;
		border-radius: 46rpx;
		height: 92rpx;
		font-size: 28rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		line-height: 92rpx;
		text-align: center;
		margin: 100rpx 0;
	}

	.page {
		box-sizing: border-box;
		padding: 0 30rpx;
	}

	.ful {
		padding: 30rpx 0;
		box-sizing: border-box;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		line-height: 40rpx;
		border-bottom: 2rpx solid #EFEFEF;

		.ful_left {
			color: #7F8084;
		}

		.ful_right {
			color: #474747;
		}
	}
</style>
